/*
* ============================================================================
*  Name     : GV60Config.h
*  Part of  : GV60
*  Copyright: Wipo Software
* ============================================================================
*/

#ifndef GV60_CONFIG_H
#define GV60_CONFIG_H

#include <e32base.h>

#define GV60_MAX_USERNAME_LEN    100
#define GV60_MAX_PASSWORD_LEN    100


class CGV60Configuration
{
  public:
    CGV60Configuration();
    ~CGV60Configuration();
  
  public:
    TBool ReadFromFile();
    TBool WriteToFile();
  
  public:
    TDesC&          GetUsername()                        { return m_iValues.iUsername; }
    TDesC&          GetPassword()                        { return m_iValues.iPassword; }
    TBool           GetInitialSync()                     { return m_iValues.bInitialSync; }

    void            SetUsername(const TDesC& iUsername)  { m_iValues.iUsername.Copy(iUsername); }
    void            SetPassword(const TDesC& iPassword)  { m_iValues.iPassword.Copy(iPassword); }
    void            SetInitialSync(TBool bInitialSync)   { m_iValues.bInitialSync = bInitialSync; }

  private:
    typedef struct 
    {
      TBuf16<GV60_MAX_USERNAME_LEN>    iUsername;
      TBuf16<GV60_MAX_PASSWORD_LEN>    iPassword;
      TBool                            bInitialSync;
      TInt                             iParity;
    } TSettingsValues;

    typedef TPckgBuf<TSettingsValues> SETTINGS_BUF;
  
  private:
    TInt   CalculateParity(const TSettingsValues& iValues);
    void   Xor(TDes8& iString);
    void   ResetValues();

  private:
    TSettingsValues  m_iValues;
};


#endif  // GV60_CONFIG_H

